﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
using Yes.Application.User;
using Yes.Core.Helper;
using Yes.Domain.Context;
using Yes.Domain.Entity;

namespace Yes.Web.Blog.Context
{
    /// <inheritdoc />
    /// <summary>
    /// 用户上下文
    /// </summary>
    public class YesUserContext : IUserContext
    {

        private readonly IUserService _userService;

        public YesUserContext(IUserService userService)
        {
            _userService = userService;
        }

        /// <inheritdoc />
        /// <summary>
        /// 当前登录用户
        /// </summary>
        public virtual LoginInfo CurrentUser => _userService.GetLoginUser();

        /// <summary>
        /// 当前登录用户Id
        /// </summary>
        public virtual int CurrentUserId => _userService.GetLoginUserId();
    }
}